<template>
	<div class="postlist">
		<!-- 头部 -->
		<van-nav-bar
			title="新闻资讯"
			fixed
			safe-area-inset-top
			:z-index="5"
			placeholder
			left-arrow
			left-text="返回"
			@click-left="$router.back()"
			@click-right="$router.push('/')"
		>
			<template #right>
				<van-icon name="wap-home-o" size="20" />
			</template>
		</van-nav-bar>
		<!-- 新闻列表 -->
		<MyPost v-for="item in postlist" :key="item.id" :post="item"></MyPost>
	</div>
</template>

<script>
import MyPost from '@/components/MyPost.vue';
import { getNewslist } from '@/apis/index.js';
export default {
	components: {
		MyPost
	},
	async created() {
		this.postlist = (await getNewslist()).data.message;
	},
	data() {
		return {
			postlist: []
		};
	}
};
</script>

<style scoped lang="less"></style>
